package com.hospital.data.simulation.controller;

import com.hospital.common.base.Result;
import com.hospital.common.pojo.TDiagnosisRecord;
import com.hospital.data.simulation.service.TDiagnosisRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 诊疗记录管理接口
 * @author yhn
 * @version 1.0
 */
@RestController
@RequestMapping("/diagnosisRecord")
public class DiagnosisRecordController {
    @Autowired
    private TDiagnosisRecordService diagnosisRecordService;

    /**
     * 添加诊疗记录
     * @param diagnosisRecord 诊疗记录
     * @return 添加的诊疗记录ID
     */
    @PostMapping("/add")
    public Result<Long> addDiagnosisRecord(@RequestBody TDiagnosisRecord diagnosisRecord){
        return Result.success(diagnosisRecordService.addTDiagnosisRecord(diagnosisRecord));
    }
    /**
     * 修改诊疗记录
     * @param diagnosisRecord 诊疗记录
     */
    @PostMapping("/update")
    public Result<?> updateDiagnosisRecord(@RequestBody TDiagnosisRecord diagnosisRecord){
        diagnosisRecordService.updateTDiagnosisRecord(diagnosisRecord);
        return Result.success();
    }
}
